<?php
class addAction extends rareAction{
	public function execute(){}
	public function executePost(){
		$news = $this->getPostParam('news',array());
		$images = $this->getPostParam('img',array());
		if(empty($news)) jsonReturn(0,'add fail!');
		$newsDao = new DaoNews();
		$news['isIndex'] = 0;
		// get system date
		$now = date("Y-m-d H:i:s");
		$news['createTime'] = $news['updateTime'] = $now;
		
		$flag = $newsDao->insert($news);
		if(!empty($images)){
			service_image::insert($images,service_type::NEWS,$flag);
		}
		if($flag > 0){
			jsonReturn(1,'ok');
		}else{
			jsonReturn(1,'fail');
		}
	}
}
?>
